#include<stdio.h>
#include<stdlib.h>
#define MaxSize 1000
typedef struct{
	int data[MaxSize];
	int front;
	int rear;
}Queue;
typedef Queue *SqQueue;
void InitQueue(SqQueue &q);
bool QueueEmpty(SqQueue q);
bool enQueue(SqQueue &q,int e);
bool deQueue(SqQueue &q,int &e);
int main(){
	int i,N,m,e,flag=1;
	scanf("%d",&N);
	SqQueue p;
	SqQueue f;
	InitQueue(p);
	InitQueue(f);
	for(i=0;i<N;i++){
		scanf("%d",&m);
		if(m%2==0)
		enQueue(p,m);
		else
		enQueue(f,m);
	}
	while(!QueueEmpty(p) || !QueueEmpty(f)){
		i=0;
		while(i<2 && !QueueEmpty(f)){
			deQueue(f,e);
			if(flag){
				flag=0;
				printf("%d",e);
			}
			else
			printf(" %d",e);
			i++;
		}			
		if(!QueueEmpty(p)){
		deQueue(p,e);
		printf(" %d",e);			
		}
}
return 0 ;
}

bool deQueue(SqQueue &q,int &e){
	if(q->front==q->rear)
	return false;
	q->front=(q->front+1)%MaxSize;
	e=q->data[q->front];
	return true;
}
bool enQueue(SqQueue &q,int e){
	if((q->rear+1)%MaxSize==q->front)
	return false;
	q->rear=(q->rear+1)%MaxSize;
	q->data[q->rear]=e;
	return true;
}
bool QueueEmpty(SqQueue q){
	return (q->front==q->rear);
}
void InitQueue(SqQueue &q){
	q=(SqQueue)malloc(sizeof(Queue));
	q->front=q->rear=0;
}
